# instructions for the montecarlo simulation

## general information
The montecarlo simulation is used to obtain p-values of the standard errors for different clustering approaches from the baseline regression. the files can be run in three different versions. Country, firmweightdomestic and bootstrap. The first two redraw macroeconmic variables of countries (among the set of countries) and firms weights (among firms from the same country) respectively and are presented in table 8. The cluster-bootstrap is used for table A38 and follows Camron et al (2008), redrawing observations from the baseline sample set.

We first run the original estimates file to save the values from the baseline regression as csv for convenience. We then call the main montecarlo.do file with settings and 4000 iterations for each spec. Note that running 4000 iterations takes quite long. The main file then calls the files run_permutation.do, compute_pvalues.do and clusterbootstrap.do to do the actual simualtions. 

## more details on different dofiles

-   montecarlo.do | implements settings, hands off to actual simulations
    -   run_permutation.do | runs the actual simulation
        -   input_permute_country.do | prepares country level variables for redrawing
        -   input permute_firmweightdomestic.do | prepares weights to be redrawn
        -   redraw_permute_country.do | redraws country variables
        -   redraw_permute_firmweightdomestic | redraws firmweights
        -   run_regression.do | runs the same regression as the baseline, but with the redrawn values
        -   save_mu_terms.do | saves the avreage macroeconmic vars
        -   save_run.do | saves coefficients from the regression
    -   compute_pvalues.do | computes P-values for the standard errors
    -   cluster_bootstrap.do | bootstraps from sample firms and runs regressions, saves coefficients